<?php
defined('BASE_PATH') || define('BASE_PATH', getenv('BASE_PATH') ?: realpath(dirname(__FILE__) . '/../..'));
defined('APP_PATH') || define('APP_PATH', BASE_PATH . '/app');
$configInit = [
    'application' => [
        'appDir'         => APP_PATH . '/',
        'controllersDir' => APP_PATH . '/controllers/',
        'modelsDir'      => APP_PATH . '/models/',
        'migrationsDir'  => APP_PATH . '/migrations/',
        'viewsDir'       => APP_PATH . '/views/',
        'pluginsDir'     => APP_PATH . '/plugins/',
        'libraryDir'     => APP_PATH . '/library/',
        'cacheDir'       => BASE_PATH . '/cache/',
        'businessDir'       => BASE_PATH . '/business/', 
        'baseUri'        => preg_replace('/public([\/\\\\])index.php$/', '', $_SERVER["PHP_SELF"]),
    ],
    //命名空间注册
    'namespaces' =>[
         'Business'    => APP_PATH."/business/",
         'PLibrary'    => APP_PATH."/library/"
    ],
    'sessionConfig' => [
        'uniqueId'   => 'g-town_phalcon3.2',
        'host'       => '',
        'port'       => 6001,
        'auth'       => 'Gtown123',
        'db'         => 4,
        'persistent' => true,
        'lifetime'   => 1800,
        'prefix'     => 'my_',
        'adapter'    => 'redis',
    ],
    // 用于phalcon tools
    'database' => [
        'adapter'     => 'Mysql',
        'host'        => 'localhost',
        'username'    => 'root',
        'password'    => '',
        'dbname'      => 'phalcon',
        'charset'     => 'utf8',
        'db_prefix'   =>  'phal_'
    ],
    'crontabLog'      => BASE_PATH."/Runtime/log"
    
];
$configInit = array_merge($configInit, require_once __DIR__.'/db.php');
$configInit = array_merge($configInit, require_once __DIR__.'/swoole.php');
return new \Phalcon\Config($configInit);
